package com.linwen.javase.desgin_pattern.BigTalkDesignPattenJAVACode._14备忘录模式._2游戏角色状态;

public class Test {

    public static void main(String[] args){

        //大战Boss前
        GameRole role = new GameRole();
        role.getInitState();
        System.out.println("大战Boss前=========");
        role.displayState();

        //保存进度
        GameRole backup = new GameRole();
        backup.setVitality(role.getVitality());
        backup.setAttack(role.getAttack());
        backup.setDefense(role.getDefense());

        //大战Boss时，损耗严重
        role.fight();
        System.out.println("大战Boss时，损耗严重=========");
        //显示状态
        role.displayState();

        System.out.println("游戏进度恢复=========");
        //游戏进度恢复
        role.setVitality(backup.getVitality());
        role.setAttack(backup.getAttack());
        role.setDefense(backup.getDefense());

        //显示状态
        role.displayState();
    }
}



